#pragma once
#include "cupid.h"

namespace cupid
{

class SyncObject;
class SingleLock 
{
	// Constructors
public:
	explicit SingleLock(SyncObject* pObject, BOOL bInitialLock = FALSE);

	// Operations
public:
	BOOL Lock(DWORD dwTimeOut = INFINITE);
	BOOL Unlock();
	BOOL Unlock(LONG lCount, LPLONG lPrevCount = NULL);
	BOOL IsLocked();

	// Implementation
public:
	~SingleLock();

protected:
	SyncObject* m_pObject;
	HANDLE  m_hObject;
	BOOL    m_bAcquired;
};
}